"""
数据库/内部使用的 Pydantic 模型
"""
from typing import Optional

from pydantic import BaseModel, EmailStr


class TokenData(BaseModel):
    """JWT payload 中携带的数据"""
    username: Optional[str] = None


class UserBase(BaseModel):
    username: str
    email: Optional[EmailStr] = None
    phone: Optional[str] = None
    name: Optional[str] = None


class UserInDB(UserBase):
    """对应 base_user 表字段的完整模型"""
    hashed_password: str
    disabled: bool = False
